<?
class Comments_Form_Comment extends Zend_Form{
    public function init(){
		$translator = new Zend_Translate(
          'array',
          APPLICATION_PATH.'/../library/Nippy/languages/lang.ru.php',
          'ru',
          array('scan' => Zend_Translate::LOCALE_DIRECTORY)
        );
		Zend_Validate_Abstract::setDefaultTranslator($translator);
        $this->addElement('text', 'Id', array(
            'required'   => false,
        	'validators' => array('Int')
            )
        );
        $this->addElement('text', 'NodeId', array(
            'required'   => true,
        	'validators' => array('Int')
            )
        );
        
        $this->addElement('text', 'Name', array(
        	'filters'    => array('StringTrim','StripTags'),
            'required'   => true,
            'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 255)))
            )
        );
        
        $this->addElement('text', 'CommentDate', array(
			'filters'    => array('StringTrim','StripTags'),
            'required'   => false,
        ));
        
        $this->addElement('text', 'Text', array(
        	'filters'    => array('StringTrim','StripTags'),
            'required'   => true,
            'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 65535)))
            )
        );
        
        $this->addElement('text', 'ModeratorName', array(
        	'filters'    => array('StringTrim','StripTags'),
            'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 255)))
            )
        );
        
        $this->addElement('text', 'ResponseDate', array(
			'filters'    => array('StringTrim','StripTags'),
            'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 32)))
        ));
        
        $this->addElement('text', 'ResponseText', array(
        	'filters'    => array('StringTrim'),
            'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 65535)))
            )
        );
        $this->addElement('checkbox', 'Publish', array('filters' => array('Int')));
	}
    public function getValidValues($params){
		$params['Publish'] = isset($params['Publish']) && $params['Publish']? 1 : 0;
		return parent::getValidValues($params);
	}
}
?>